package cn.iocoder.yudao.module.system.dal.mysql.areaserve;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.areaserve.vo.AreaDepartementPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.areaserve.AreaDepartementDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;

@Mapper
public interface AreaDepartementMapper extends BaseMapperX<AreaDepartementDO> {

    default PageResult<AreaDepartementDO> selectPage(AreaDepartementPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AreaDepartementDO>()
                .eqIfPresent(AreaDepartementDO::getOfficeName, reqVO.getOfficeName())
                .eqIfPresent(AreaDepartementDO::getAreaName, reqVO.getAreaName())
                .eqIfPresent(AreaDepartementDO::getDepartmentName, reqVO.getDepartmentName())
                .orderByDesc(AreaDepartementDO::getId));
    }

    default List<AreaDepartementDO> selectByMap(Map<String,Object> reqVO) {
        List<AreaDepartementDO> test = selectList(new LambdaQueryWrapperX<AreaDepartementDO>()
                .eqIfPresent(AreaDepartementDO::getOfficeName, reqVO.get("Office_name"))
                .orderByDesc(AreaDepartementDO::getId));
        return test;
    }
}



